<extend name="layout/main" />

<block name="HEADER">
	<style type="text/css">
        .iconfont.stars{ padding: 0 3px; line-height: 1; color: #e4e4e4; }
        .iconfont.yellow{ color: #ffa500; }
        .xw__grid .layui-table-view .layui-table td .layui-table-cell .link{ margin: 0 3px; }
    </style>
</block>

<block name="CONTENT">
	<div class="wrapper">
		<div class="panel-heading">
			<control:search id="searchs" />
		</div>
		<div class="content">
			<control:grid id="grid" padding="0" height="100%" />
		</div>
	</div>
</block>

<block name="FOOTER">
	<script type="text/javascript">
		var page = (function(ns){
    
            //分类模板
            ns.gridEvaluateTemplet= function(e){
                var sHtml = "";
                for (var i = 0; i < 5; i++) {
                    sHtml+= "<i class='iconfont stars "+( i < e.value ? "yellow" : '')+"'>&#xe612;</i>";
                }
                return sHtml;
            }
             
            //页面初始化
            ns.init=function(){
                ns.query();
            }
            
            //搜索事件
            ns.query=function(){
                grid.load( searchs.getData() );
            }
            
            //启用与禁用
            //mode=0 等于禁用
            ns.signout=function(user_guid){
                $.confirm( "确认退出？" ,function(index){
                    $.ajaxs("/admin/v1/app_user/signout",{
                        user_guid: user_guid
                    },function(res){
                        grid.load();
                        $.toast(1, res.msg);
                    });
                    layer.close(index);
                });
            }
            
            return ns;
        }({}));
        
        $(function(){ page.init();  });
	</script>
</block>